package com.sykj.cloud.activity.service.impl;

import com.sykj.cloud.activity.domain.ActivitySession;
import com.sykj.cloud.activity.mapper.ActivitySessionMapper;
import com.sykj.cloud.activity.service.IActivitySessionService;
import com.sykj.cloud.common.core.utils.DateUtils;
import com.sykj.cloud.common.core.utils.IdUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 活动场次Service业务层处理
 *
 * @author mr.will
 * @date 2021-04-01
 */
@Service
public class ActivitySessionServiceImpl implements IActivitySessionService
{
    @Autowired
    private ActivitySessionMapper activitySessionMapper;

    /**
     * 新增活动场次
     *
     * @param activitySession 活动场次
     * @return 结果
     */
    @Override
    public int insertActivitySession(ActivitySession activitySession)
    {
        activitySession.setGuid(IdUtils.fastSimpleUUID());
        activitySession.setCreateTime(DateUtils.getNowDate());
        return activitySessionMapper.insertActivitySession(activitySession);
    }

    /**
     * 修改活动场次
     *
     * @param activitySession 活动场次
     * @return 结果
     */
    @Override
    public int updateActivitySession(ActivitySession activitySession)
    {
        activitySession.setUpdateTime(DateUtils.getNowDate());
        return activitySessionMapper.updateActivitySession(activitySession);
    }

    /**
     * 批量删除活动场次
     *
     * @param guids 需要删除的活动场次ID
     * @return 结果
     */
    @Override
    public int deleteActivitySessionByIds(String[] guids)
    {
        return activitySessionMapper.deleteActivitySessionByIds(guids);
    }

    /**
     * 删除活动场次信息
     *
     * @param guid 活动场次ID
     * @return 结果
     */
    @Override
    public int deleteActivitySessionById(String guid)
    {
        return activitySessionMapper.deleteActivitySessionById(guid);
    }

    /**
     * 查询活动场次
     *
     * @param guid 活动场次ID
     * @return 活动场次
     */
    @Override
    public ActivitySession getActivitySessionById(String guid)
    {
        return activitySessionMapper.getActivitySessionById(guid);
    }

    /**
     * 查询活动场次列表
     *
     * @param activitySession 活动场次
     * @return 活动场次
     */
    @Override
    public List<ActivitySession> listActivitySessions(ActivitySession activitySession)
    {
        return activitySessionMapper.listActivitySessions(activitySession);
    }
}
